<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <base href="${request.contextPath}/"/>
    <meta charset="UTF-8">
    <meta name="Keywords" content="">
    <meta name="Description" content="">
    <meta name="format-detection" content="telephone=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0,minimum-scale=1.0">
    <title>漠河智慧社区</title>
    <link href="Content/wechat/css/reset.css" rel="stylesheet" type="text/css">
    <link href="Content/wechat/css/shengHuo_QCSJ.css" rel="stylesheet" type="text/css">
    <link href="Content/wechat/css/layer.css" rel="stylesheet" type="text/css">
    <script src="Content/wechat/js/jquery.min.js"></script>
    <!--字体缩放-->
    <script src="Content/wechat/js/ziti.js"></script>
    <!--end 字体缩放-->
    <script src="Content/wechat/js/layer.js" type="text/javascript" charset="utf-8"></script>
    <style type="text/css">
        .qyml_l_box{
            float: left;
            width: 30%;
        }
        .qyml_l_wenzi{
            float: left;
            width: 63%;
        }
        .nowrap {
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .qyml_l_wenzi_xx{
            width: 100%;
        }
        .qyml_l_wenzi_xx i{
            float: left;
            display: inline-block;
            width: 0.3rem;
            height: 0.3rem;

        }
        .qyml_l_wenzi .qyml_l_wenzi_xx i img{
            width: 100%;
            vertical-align: middle;


        }
        .qyml_l_wenzi_xx p{
            font-size: 0.24rem;
            color: #949494;
            padding: 0.08rem 0;
        }
    </style>
</head>
<body>
<!--header-->

<!--end  header-->
<!--搜索-->
<div>
    <div id="shoplist">
        <div class="qyml clearfix">
            <div class="qyml_l">
                <div class="qyml_l_img">
                    <img src="Content/wechat/images/sq.jpg">
                </div>
                <div class="qyml_l_wenzi">
                    <h3>漠河北区公安局</h3>
                    <p>
                        <i>
                            <img src="Content/wechat/images/weizhi.png">
                        </i>
                        北大加油5-2号</p>
                    <b id="txt2"></b>
                </div>


            </div>
            <div class="qyml_r">
                <a>
                    <img src="Content/wechat/images/tel_01.png">
                </a>
            </div>
        </div>
    </div>
</div>
<!--加入收藏js-->


</body>
<script type="text/javascript">

    function shoucang(obj) {
        var shopid = obj.getAttribute("data-value");
        layer.open({
            title: [
                '取消收藏',
                'background-color:#6495ed; color:#fff;'
            ]
            ,anim: 'up'
            ,content: '是否确定取消收藏？'
            ,shadeClose: false
            ,btn: ['确定', '返回']

            ,yes: function(index){
                //location.reload();
                $.ajax({
                    url: "/wechat/personage/collection/delcollection",
                    type: 'post',
                    dataType: 'json',
                    data: {
                        shopid: shopid
                    },
                    success: function (result) {
                        if (result.data == "1") {
                            obj.parentNode.parentNode.parentNode.remove();

                            alert("取消成功！");
                        } else {
                            alert("取消失败！");
                        }
                    }
                })

                layer.close(index);
            }
            ,no: function(index){
              //  window.history.go(-1);
                layer.close(index);
            }
        });





    }


</script>
<!--end加入收藏js-->


</body>
<script>
    window.onload = function () {
        InitAjax();
    }

</script>
<script>

    function InitAjax() {
        $.ajax({
            url: "/wechat/personage/collection/selectListbyopenid",
            type: 'post',
            dataType: 'json',
            data: {}, success: function (result) {
                ajaxCallBack(result);
            }

        })
    }

    function ajaxCallBack(data) {
        var insetViewData = ""; //视图数据
        $.each(data.data, function (index, items) {

            // insetViewData += "<div class=\"qyml clearfix\">\n" +
            //     "            <div class=\"qyml_l\" onclick=\"window.location.href='/wechat/home/life/qcsj/affair_QCSJ_XQ?id="+items.id+"'\">\n" +
            //     "                <div class=\"qyml_l_img\">\n" +
            //     "                    <img src=\"" + items.imgurl + "\" onerror=src=\"Content/wechat/images/sq.jpg\">\n" +
            //     "                </div>\n" +
            //     "                <div class=\"qyml_l_wenzi\">\n" +
            //     "                    <h3>" + items.sname + "</h3>\n" +
            //     "                    <p>\n" +
            //     "                        <i>\n" +
            //     "                            <img src=\"Content/wechat/images/weizhi.png\">\n" +
            //     "                        </i>\n" +
            //     // "                        " + items.communityname + items.villagename + items.buildingnumname + "</p>\n" +
            //     "                        地址："+items.buildingnumname+"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;电话："+items.sphone+"</p>\n" +
            //     "                    <b id=\"txt2\" class=\"txx\" data-value=\"" + items.id + "\"onclick=\"shoucang(this);\"></b>\n" +
            //     "                </div>\n" +
            //     "\n" +
            //     "\n" +
            //     "            </div>\n" +
            //     "            <div class=\"qyml_r\">\n" +
            //     "                <a href='tel:" + items.sphone + "'>\n" +
            //     "                    <img src=\"Content/wechat/images/tel_01.png\">\n" +
            //     "                </a>\n" +
            //     "            </div>\n" +
            //     "        </div>";

            insetViewData +="<div class=\"qyml clearfix\">\n" +
                "            <div class=\"qyml_l\" >\n" +
                "                <div class=\"qyml_l_box\" onclick=\"window.location.href='/wechat/home/life/qcsj/affair_QCSJ_XQ?id="+items.id+"'\">\n" +
                "                    <div class=\"qyml_l_img\">\n" +
                "                         <img src=\""+items.imgurl+"\" onerror=src=\"Content/wechat/images/sq.jpg\">\n" +
                "                    </div>\n" +
                "                </div>\n" +
                "                <div class=\"qyml_l_wenzi  \" >\n" +
                "                    <h3 class=\"nowrap\">"+items.sname+"</h3>\n" +
                "                    <div class=\"qyml_l_wenzi_xx clearfix\" onclick=\"window.location.href='/wechat/home/life/qcsj/affair_QCSJ_XQ?id="+items.id+"'\">\n" +
                "                        <p class=\"nowrap\">\n" +
                "                            <i>\n" +
                "                                <img src=\"Content/wechat/images/weizhi.png\">\n" +
                "                            </i>"+items.buildingnumname+"\n" +
                "                        </p>\n" +
                "                    </div>\n" +
                "                    <div class=\"qyml_l_wenzi_xx clearfix\" onclick=\"window.location.href='/wechat/home/life/qcsj/affair_QCSJ_XQ?id="+items.id+"'\">\n" +
                "                        <p class=\"nowrap\">\n" +
                "                            <i>\n" +
                "                                <img src=\"Content/wechat/images/tl.png\">\n" +
                "                            </i>"+items.sphone+"\n" +
                "                        </p>\n" +

                "                    </div>\n" +
                "                    <b id=\"txt2\" class=\"txx\" data-value=\""+items.id+"\"onclick=\"shoucang(this);\"></b>\n" +
                "                </div>\n" +
                "            </div>\n" +

                "            <div class=\"qyml_r\">\n" +
                "                <a href='tel:"+items.sphone+"'>\n" +
                "                    <img src=\"Content/wechat/images/tel_01.png\">\n" +
                "                </a>\n" +
                "            </div>\n" +
                "        </div>";

        });
        $("#shoplist").html(insetViewData);
    }


</script>
</html>